//
//  IKLibrary.h
//  IiecgFrameWork
//
//  Created by 123456 on 2017/8/2.
//  Copyright © 2017年 SaltWong. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "IKLibrary.h"
#import "IKCode.h"

@protocol IIKSystemEvent <NSObject>

-(void)OnReciveSystemEvent:(IKSystemEvent)type userdata:(id)userdata;


@end

@protocol IIKEcgDataEvent <NSObject>

-(void)OnReciveEcgData:(int)ecgdata;

@end

@protocol IIKEcgStateEvent  <NSObject>

-(void)OnReciveEcgState:(EcgState)state Desc:(NSString *)desc andUserdata:(id)userdata;

@end

@protocol IIKEcgCheckEndEvent <NSObject>

-(void)OnEcgCheckEnd:(id)userObject;

@end

@protocol IIKEcgDeviceNoWhiteListEvent <NSObject>

-(void)OnEcgDeviceNoWhiteListEventDeviceId:(NSString *)deviceId;

@end


@protocol IIKEcgDeviceScanEvent <NSObject>

-(void)OnEcgScanDeviceDataDeviceId:(NSString *)deviceId deviceName:(NSString *)deviceName;

@end

@interface IKEcgCheck : NSObject<IBLEViewModelCallBack>

@property(nonatomic,assign,readonly,getter=isDebug)BOOL debug;
@property (nonatomic,strong)id<IBLEViewModel> ibleViewModel;

+(instancetype)getInstance;


-(IKCodeType)IKInit;
/**
 释放sdk库
 */
-(void)IKUninit;

-(void)IKRegistSystemEvent:(id<IIKSystemEvent>)systemEvent userdata:(id)userdata;

/**
 开始检测
 */
-(int)IKStartEcgCheck:(NSString *)ssinfo checkTime:(int)checkTime;

/**
 停止检测
 */
-(void)IKStopEcgCheck;

/**
 生成PDF报告

 @return pdf路径
 */
-(NSString *)IKGetCurrEcgPDF;

/**
 获取心电图的智能分析结果

 @return 心电图分析结果
 */
-(NSString *)IKGetCurrEcgSmartResult;

/**
 获得tar包文件路径,完整测试一次

 @return tar包路径
 */
-(NSString *)IKGetCurrEcgDataFilePath;
/**
 设置白名单

 @param deviceId ecg 设备 id
 @param deviceName ecg 设备名称
 */
-(void)IKSetEcgDeviceWhiteListDeviceId:(NSString *)deviceId deviceName:(NSString *)deviceName;


/**
 开始扫描ecg设备

 @return 成功0 失败见错误码
 */
-(int)IKStartEcgDeviceScan;


/**
 停止扫描ecg设备

 @return 成功返回0 失败见错误码
 */
-(int)IKStopEcgDeviceScan;

/**
 解压tar包

 @param ecgDataFilePath tar包路径
 @param ecgdatas 心电数据
 @return 结果
 */
-(int)IKUnPackEcgDataFileEcgDataFilePath:(NSString *)ecgDataFilePath ecgdatas:(int *)ecgdatas;

/**
 获取心电数据和心电状态数据
 */
- (int)IKEcgAnalyzeSdkGetEcgDataFromFile:(NSString*)ecgDataFilePath ecgSize:(int)size ecgData:(int*)ecgdata ecgState:(int*)ecgstate;
/**
 根据tar包路径获取心电数据长度
 */
- (NSInteger)IKEcgAnalyzeSdkGetEcgDataLength:(NSString*)ecgDataFilePath;


//注册回调
-(void)IKRegistEcgDataEvent:(id <IIKEcgDataEvent>)ecgdataEvent;

-(void)IKRegistEcgStateEvent:(id<IIKEcgStateEvent>)ecgstate andUserData:(id)userData;

-(void)IKRegistEcgCheckEndEvent:(id<IIKEcgCheckEndEvent>)chenkendEvent andUserData:(id)userData;

-(void)IKRegistEcgDeviceNoWhiteListEvent:(id <IIKEcgDeviceNoWhiteListEvent>)ecgDeviceNo;

-(void)IKRegistEcgDeviceScanEvent:(id<IIKEcgDeviceScanEvent>)ecgDeviceScanEvent;



/**
 *  获取x的点数
 *
 *  @param millimeter 毫米
 *  @param filePath   心电tar包路径
 *
 *  @return x方向点数
 */
-(int) IKGetUnitsFromMillimeterX:(int) millimeter filePath:(NSString*)filePath;
/**
 *  获取y的点数
 *
 *  @param millimeter 毫米
 *  @param filePath   心电tar包路径
 *
 *  @return y方向点数
 */
-(int) IKGetUnitsFromMillimeterY:(int) millimeter filePath:(NSString*)filePath;

/**
 生成一个全球唯一标识符UUID

 @return return value description
 */
-(NSString *)IKCreateUUID;

/**
 获取心电设备的采样率
 */
-(NSInteger)IKGetEcgSampleRate;

@end
